<?php
/* 
 * Copyright (c) 2018-{{Y}}   All rights reserved.
 *
 * 创建时间：{{$YmdHi}}
 *
 * 项目：{{$classdir}}/levcc  -  $  - AdminUserController.php
 *
 * 作者：{{AUTO GENERATE}}
 */

//此文件使用程序自动生成，下次生成时【不会】覆盖。
//在这里可以补充、完善你的程序逻辑

namespace modules\levcc\controllers;

use Lev;
use lev\base\Viewv;
use modules\levcc\controllers\_gen\BaseAdminUser;
use modules\levcc\table\pre_admin_user\userModelHelper;

!defined('INLEV') && exit('Access Denied LEV');

class BaseAdminUserMiddle extends BaseAdminUser
{

    public static function adminop()
    {
        //userModelHelper::setFieldDateTotimestamp('uptime');//将用户传入的date 日期字符串转换为整型
        return parent::adminop(); // TODO: Change the autogenerated stub
    }

    public static function headerHtm()
    {
        return parent::headerHtm(); // TODO: Change the autogenerated stub
        //return parent::headerRankHtm();
        //return '<tips class="gray inblk scale8">自定义headerHtm：文件位置：'.__DIR__ . '/AdminUserController.php'.'</tips>';
        //return Viewv::renderPartial(__DIR__ . '/../template/renders/admin-user/myself/header_htm.php', []);
    }

    public static function footerHtm()
    {
        return parent::footerHtm(); // TODO: Change the autogenerated stub
        //return '<tips class="gray inblk scale8">自定义footerHtm</tips>';
    }

    public static function cardFooterButtons($btns = [])
    {
        return parent::cardFooterButtons($btns); // TODO: Change the autogenerated stub
        //return '<tips class="gray inblk scale8">自定义cardFooterButtons</tips>';
    }

    public static function headerViewHtm()
    {
        return parent::headerViewHtm(); // TODO: Change the autogenerated stub
        //return '<tips class="gray inblk scale8">自定义headerViewHtm：文件位置：'.__DIR__ . '/AdminUserController.php'.'</tips>';
    }

    public static function footerViewHtm()
    {
        return parent::footerViewHtm(); // TODO: Change the autogenerated stub
        //return '<tips class="gray inblk scale8">自定义footerViewHtm</tips>';
    }
}

class AdminUserController extends BaseAdminUserMiddle
{

    public static $tmpPath = 'admin-user';
    public static $trash   = true;//是否允许删除数据
    public static $addurl  = false;//是否显示创建数据按钮
    public static $addRoute = '{{$addRoute}}';//自定义创建数据表单地址 - 默认使用源表单

    public static $copyOneBtn  = false;//复制一条数据

    public static $srhtitle    = '';//模糊搜索字段名称
    public static $srhkeyWhere = '';//模糊搜索sql语句 例：name LIKE '%{srhkey}%'

    public static $limit = 20;//每页显示多少条
    public static $order = ['id DESC'];//排序

    /**
     * 列表显示字段设置
     * 例：array(
    'id'           => array('order' => null, 'name' => 'Id', 'thattr' => 'wd30 nowrap', 'merge' => []),

    'name'         => array('order' => null, 'name' => '模块名称', 'thattr' => 'wd30 nowrap', 'merge' => ['addtime']),

    'displayorder' => array('order' => null, 'name' => '排序', 'thattr' => 'wd30 nowrap', 'merge' => []),

    'uptime'       => array('order' => null, 'name' => '更新时间', 'thattr' => 'wd30 nowrap', 'merge' => []),

    );
     *
     * order: 点击字段排序
     * name: 字段名称
     * thattr: 表格th属性，放class属性内，内容举例：wd30 nowrap" style="font-size:12px
     * merge: 合并显示，多个字段合并显示到一个上
     *
     * @see BaseAdminUser::showColumns();
     */
    public static function showColumns() {
        //return parent::showColumns(); // TODO: Change the autogenerated stub
        return "{{showColumnsConfig}}";
    }

    /**
     *
     return [
        'showtype' => [
            //从上往下先到先得
            'input_{columnKey}'  => ['width'=>120,'textarea'=>1, 'type'=>null],//显示为无刷新更改字段 type=>'date' 或其它input type类型
            'srhkey_{columnKey}' => ['or'=>['{columnKey}']],//显示为点击可搜索字段
            'status_{columnKey}' => 1,//显示为开关状态字段 status 自动
            'order_{columnKey}'  => 1,//显示为可排序输入框 含order关键字 自动
            'time_{columnKey}'   => 1,//显示为时间格式字段 含time关键字 自动
        ],
    ];
     *
     * @return array
     */
    public static function setColumnShowtype()
    {
        return parent::setColumnShowtype(); // TODO: Change the autogenerated stub
    }
    public static function addWhere($where)
    {
        //$where[] = 'id='.floatval($_GET['opid']);
        return parent::addWhere($where); // TODO: Change the autogenerated stub
    }


    public static function formatListsv($sv, $lists)
    {
        $v = $sv;
        $sv = userModelHelper::formatUpdata($sv, false);
        $sv = parent::formatListsv($sv, $lists); // TODO: Change the autogenerated stub
        //$sv = userModelHelper::formatListvField($sv, $lists);
        return $sv;
    }

    public static function formatUid($sv, $lists, $srhkey = ['uid'], $username0 = '')
    {
        return parent::formatUid($sv, $lists, $srhkey, $username0); // TODO: Change the autogenerated stub
    }

    public static function redirct($columnKey, $sv)
    {
        return parent::redirct($columnKey, $sv); // TODO: Change the autogenerated stub
    }

    public static function optButtons($sv)
    {
        return parent::optButtons($sv); // TODO: Change the autogenerated stub
    }

    public static function footerBtns($btns = [])
    {
        return parent::footerBtns($btns); // TODO: Change the autogenerated stub
    }

}